@namespace SwashbucklerDiary.Rcl.Pages
@inherits DialogComponentBase

<CustomMDialog MyValue="Visible"
               MyValueChanged="InternalVisibleChanged"
               ContentClass="rounded-lg"
               MaxWidth="420"
               DisableAutoFocus
               OnMousedownPreventDefault
               OnBeforeShowContent="HandleOnBeforeShowContent">
    <MCard>
        <MCardTitle Class="font-weight-bold flex-nowrap">
            <wc-auto-scroll-text>@I18n.T("Insert Time format")</wc-auto-scroll-text>
            <MSpacer></MSpacer>
            <MButton Icon
                     OnClick="()=>showMore=true">
                <MIcon>info</MIcon>
            </MButton>
            <MButton Icon
                     OnClick="HandleOnCancel">
                <MIcon>close</MIcon>
            </MButton>
        </MCardTitle>
        <MCardText Class="pb-0">
            <p class="text-h5 mb-4 font-italic font-weight-bold">
                <CurrentTimeDisplay Format="@CurrentTimeFormat"></CurrentTimeDisplay>
            </p>

            <CustomMTextField @ref="textField"
                              @bind-Value="internalValue"
                              OnEnter="HandleOnEnter"
                              Dense
                              MinHeight="44"
                              Filled
                              Rounded
                              spellcheck="false">
            </CustomMTextField>

            <span class="subheading">@I18n.T("Add Time type")</span>

            <MChipGroup Column="true">
                @foreach (var item in timeMap)
                {
                    <MChip @key="item.Value"
                           IsActive="false"
                           OnClick="()=>AddTimeAsync(item.Value)">
                        @(I18n.T(item.Key))
                    </MChip>
                }
            </MChipGroup>
        </MCardText>
        <MCardActions Class="pt-0">
            <MButton Text="true" OnClick="OnReset">
                <wc-auto-scroll-text style="max-width:100px;">@(I18n.T("Restore the default"))</wc-auto-scroll-text>
            </MButton>
            <MSpacer></MSpacer>
            <MButton Text
                     OnClick="HandleOnCancel">
                @(I18n.T("Cancel"))
            </MButton>
            <MButton Text
                     Color="primary"
                     OnClick="HandleOnOK">
                @(I18n.T("Save"))
            </MButton>
        </MCardActions>
    </MCard>
</CustomMDialog>

<CustomMDialog @bind-MyValue="showMore"
               ContentClass="rounded-lg"
               MaxWidth="420"
               DisableAutoFocus
               OnMousedownPreventDefault>
    <MCard>
        <MCardTitle Class="font-weight-bold flex-nowrap">
            <wc-auto-scroll-text>@I18n.T("More")</wc-auto-scroll-text>
            <MSpacer></MSpacer>
            <MButton Icon
                     OnClick="()=>showMore=false">
                <MIcon>close</MIcon>
            </MButton>
        </MCardTitle>
        <MCardText>
            <p>
                <a href="https://learn.microsoft.com/dotnet/standard/base-types/standard-date-and-time-format-strings" target="_blank">
                    @I18n.T("Standard date and time format strings")
                </a>
            </p>
            <p>
                <a href="https://learn.microsoft.com/dotnet/standard/base-types/custom-date-and-time-format-strings" target="_blank">
                    @I18n.T("Custom date and time format strings")
                </a>
            </p>
        </MCardText>
    </MCard>
</CustomMDialog>
